package org.yty.travelagencyredis.model.Entity;

import lombok.Data;

import java.io.Serializable;
@Data
public class Result<T> implements Serializable {
    private int code;
    private String msg;
    private T data;
    private Result(int code,String msg, T data){
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    public static <T> Result<T> ok(T data){
        return new Result<>(0,"success",data);
    }
    public static <T> Result<T> ok(){
        return new Result<>(0,"success",null);
    }
    public static <T> Result<T> error(String msg){
        return new Result<>(-1,msg,null);
    }
}
